import { stat } from 'fs';
import {
  createArticle,
  deleteArticleByName,
  updateArticle,
  defaultArticleModel,
  ArticleType,
  getArticles
} from '/@/request/articles'
export default class SchemeMap {

    public static async displayJiJie(state: any) {
        let res:any = await getArticles({ currentPage: 1, pageCount: 10, importance: "集结点" }, ArticleType.SSYS);
        state.getTblData.data.push(...res.data);
        res.data.forEach(ele => {
          state.jijieDian.push({
            name: ele.title,
            value: [ele.sourceURL, ele.imageURL],
            symbol: "image://",
            symbolSize:[51/2,76/2],
            isSelectDian:false
          });
          
        });
        state.myChart.setOption({
          series: [
            {
              // 根据名字对应到相应的系列
              name: "集结点",
              data: state.jijieDian,
              // symbol: "image://",
              symbolSize:[51,76]
            }
          ]
        });
        return Promise.resolve();
      }
    
      public static async delay(time: number) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve(null);
          }, time);
        });
      }
    
      public static getImaData(isSelect:boolean){
        if(isSelect == false)
        return "image://";

        return "image://";
      }
      public static updateSchemeLines(busLines){
        let data = [
          {
            name:"调度中",
            type: 'lines',
            coordinateSystem: 'bmap',
            polyline: true,
            data: busLines,
            silent: false,
            lineStyle: {
              // color: '#c23531',
              // color: 'rgb(200, 35, 45)',
              opacity: 0.2,
              width: 10
            },
            progressiveThreshold: 500,
            progressive: 200
          },
          {
            name:"调度中",
            type: 'lines',
            coordinateSystem: 'bmap',
            polyline: true,
            silent: true,
            data: busLines,
            lineStyle: {
              width: 0
            },
            effect: {
              symbol:'arrow',
              constantSpeed: 40,
              show: true,
              trailLength: 0.9,
              symbolSize: 10,
              loop:true
            },
            zlevel: 1
          }
        ];
        return data;
      }
}